This aligns the keyboard navigation behavior with similar menus in
other desktop environments and with GTK itself.
It allows the users to move in the menu using already known patterns
and makes the operation quicker in some cases, especially as many
users don't know about the tab and shift+tab behavior.
Closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6017
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2525>
this.activate(event);
return Clutter.EVENT_STOP;
}
+
+ // Support wrapping navigation in the menu
+ if (symbol === Clutter.KEY_Up || symbol === Clutter.KEY_Down) {
+ const group = global.focus_manager.get_group(this);
+ const direction = symbol === Clutter.KEY_Up
+ ? St.DirectionType.UP
+ : St.DirectionType.DOWN;
+ if (group?.navigate_focus(this, direction, true))
+ return Clutter.EVENT_STOP;
+ }
return Clutter.EVENT_PROPAGATE;
}